package cn.edu.scujcc.customofsichuan;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.TextView;

import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;

public class explore_Detail extends AppCompatActivity{

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_explore_detail);
        Toolbar toolbar = findViewById(R.id.toolbar_smallCard_hbj);
        TextView explore_title = findViewById(R.id.explore_title);
        WebView explore_detail = findViewById(R.id.explore_detail);
        toolbar.setNavigationOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
        Bundle bundle = getIntent().getExtras();
        String title = bundle.getString("title");
        String webUrl = bundle.getString("webUrl");
        explore_title.setText(title);
        loadPage(explore_detail,webUrl);

    }

    private void loadPage(WebView web, String webUrl) {
        WebSettings settings = web.getSettings();
        //必须开启JavaScript，否则地图空白无法显示
        settings.setDomStorageEnabled(true);
        settings.setGeolocationEnabled(true);
        settings.setJavaScriptEnabled(true);
        settings.setDatabaseEnabled(true);
        web.loadUrl(webUrl);
        web.setWebViewClient(new WebViewClient());

    }

}